/**
 * Created by no1 on 2015/6/30.
 */
'use strict';

/**
 * Module shop.
 */

let mongoose = require('mongoose');
let Schema = mongoose.Schema;
let ObjectId = mongoose.Schema.ObjectId;

//let shop = require('../schema/shop');
//let extend = require('mongoose-schema-extend');
//let baseSchema = require('../schema/base').baseSchema

let evaluation = new Schema({
    //商家ID
    vendorid: {
        type: ObjectId,
        ref: 'vendor'
    },
    //商品ID
    wareid: {
        type: ObjectId,
        ref: 'ware'
    },
    //用户ID
    uid: {
        type: ObjectId
    },
    //图片/tmp/1.jpg
    image: [String],
    //内容
    content: String,
    //总评价得分
    eTotal: Number,
    //评价
    esTimate: Number,
    //评价总数
    eCount: Number,
    //环境评价
    decoration_grade: Number,
    //服务评价
    service_grade: Number
});

evaluation.index({
    vendorid: 1,
    wareid: 1,
    uid: 1
});


module.exports = mongoose.model('evaluation', evaluation);